/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.awt.Graphics;
import java.awt.Image;
import java.io.IOException;
import java.net.URL;
import javax.imageio.ImageIO;

/**
 *
 * @author Misja
 */
public class Field {

    private int xCoordinate, yCoordinate;
    private GamePart part;
    private Image terrain;

    public Field(int x, int y){
        this.xCoordinate = x * 30;
        this.yCoordinate = y * 30;

        URL url = this.getClass().getResource("steentje.gif");
        try {
            this.terrain = ImageIO.read(url);
        } catch (IOException ex) {
        }
    }

    /**
     *
     * @param g
     */
    public void draw(Graphics g) {
        if(this.part != null){
            this.part.draw(g, this.xCoordinate, this.yCoordinate);
        } else {
             g.drawImage(terrain, this.xCoordinate, this.yCoordinate, null);
        }
    }

    /**
     * @return the xCoordinate
     */
    public int getxCoordinate() {
        return xCoordinate;
    }

    /**
     * @param xCoordinate the xCoordinate to set
     */
    public void setxCoordinate(int xCoordinate) {
        this.xCoordinate = xCoordinate;
    }

    /**
     * @return the yCoordinate
     */
    public int getyCoordinate() {
        return yCoordinate;
    }

    /**
     * @param yCoordinate the yCoordinate to set
     */
    public void setyCoordinate(int yCoordinate) {
        this.yCoordinate = yCoordinate;
    }

    /**
     * @return the part
     */
    public GamePart getPart() {
        return part;
    }

    /**
     * @param part the part to set
     */
    public void setPart(GamePart part) {
        this.part = part;
    }
}
